package(default_visibility=["//visibility:public"])

load("//tools:sass_bundle.bzl", "sass_bundle")
load("//tools:defaults.bzl", "ng_module", "ng_package")
load("//:packages.bzl", "MATERIAL_PACKAGES", "MATERIAL_TARGETS", "MATERIAL_SCSS_LIBS",
    "ROLLUP_GLOBALS")

# Root "@angular/material" entry-point.
ng_module(
  name = "material",
  srcs = glob(["*.ts"], exclude=["**/*.spec.ts"]),
  module_name = "@angular/material",
  deps = ["//src/lib/%s" % p for p in MATERIAL_PACKAGES],
)

sass_bundle(
  name = "theming_bundle",
  srcs = [
    "//src/cdk/a11y:a11y_scss_lib",
    "//src/cdk/overlay:overlay_scss_lib",
    "//src/cdk/text-field:text_field_scss_lib",
  ] + MATERIAL_SCSS_LIBS,
  entry_point = '//src/lib/core:theming/_all-theme.scss',
  output_name = "_theming.scss",
)

filegroup(
  name = "overviews",
  srcs = ["//src/lib/%s:overview" % name for name in MATERIAL_PACKAGES]
)

# Creates the @angular/material package published to npm.
ng_package(
  name = "npm_package",
  srcs = ["package.json"],
  entry_point = "src/lib/public_api.js",
  entry_point_name = "material",
  globals = ROLLUP_GLOBALS,
  data = [
    ":theming_bundle",
    "//src/lib/prebuilt-themes:indigo-pink",
    "//src/lib/prebuilt-themes:deeppurple-amber",
    "//src/lib/prebuilt-themes:pink-bluegrey",
    "//src/lib/prebuilt-themes:purple-green",
  ],
  packages = ["//src/lib/schematics:npm_package"],
  deps = MATERIAL_TARGETS,
  # TODO(devversion): Use the npm package for publishing. Right now this is disabled because
  # we build using AOT for serving & testing, but the `ng_package` rule should not include factory
  # files.
  tags = ["manual"],
)
